
package com.lcy.service.impl;

import com.lcy.dao.SmbmsUserDao;
//import com.lcy.dao.impl.SmbmsUserDaoImpl;
import com.lcy.entry.SmbmsUser;
import com.lcy.service.LoginService;
import com.lcy.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("loginService")
public class LoginServiceImpl implements LoginService {
    @Autowired
    SmbmsUserDao smbmsUserDao;

    @Override
    public boolean login(String userCode, String userPassword) {
        System.out.println(userCode);
        System.out.println(userPassword);
        //   SqlSession sqlSession = MybatisUtils.getSqlSession();
        //   SmbmsUserDao smbmsUserDao = sqlSession.getMapper(SmbmsUserDao.class);
        //  SqlSession sqlSession = MybatisUtils.getSqlSession();
        //     SmbmsUserDao smbmsUserDao = sqlSession.getMapper(SmbmsUserDao.class);
        SmbmsUser smbmsUser = smbmsUserDao.getSmbmsUserByUserCode(userCode);
        //  MybatisUtils.closeSqlSession(sqlSession);
        if (smbmsUser != null) {
            if (userPassword.equals(smbmsUser.getUserPassword())) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
}

